<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>付款申请单支付</title>
        <script language="javascript">
            function updateCostItemName(code,name)
            {
                document.getElementById('appBill:costcode').value = code;
                document.getElementById('appBill:costname').value = name;
            }
            function showCostItem(){
                window.open("./pubinfo/costItemList.jsf","费用项目","height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
        </script>

        <style type="text/css">
            table.voucherGrid{
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.voucherGrid td{
                border:1px solid #e2e2e2;
            }

            table.checkGrid{
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.checkGrid td{
                border:1px solid #e2e2e2;
            }
            .demo_fieldset {
                margin : 20px;
                border : 1px solid #ACBECE;
            }

            .demo_legend {
                font-weight : bold;
                margin : 0px 10px 0px 18px;
                font-family: Verdana;
            }
            .inputstype{
                width: 175px !important;
            }
            .pic{
                margin-bottom: -4px;
                margin-right: -2px;
                border:none;
                width:20px;
                height:20px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="appBill">
            <rich:panel header="付款申请单支付" styleClass="content-hight">
                <rich:messages globalOnly="true"/>
                <rich:toolbar  itemSeparator="grida">
                    <rich:toolbarGroup>
                        <h:commandLink  action="#{appPay.checkPayandRep}"
                                        disabled="#{appPay.voucher.numberStatus != '2'}">
                            <h:graphicImage value="./images/pay.png" styleClass="pic" title="支付" />
                        </h:commandLink>
                        <h:commandLink  action="#{appPay.payrescind}"
                                        disabled="#{appPay.voucher.numberStatus == '2'
                                                    ||appPay.voucher.numberStatus == '0'
                                                    ||appPay.voucher.numberStatus == '3'}">
                            <h:graphicImage value="./images/chexiao.png" styleClass="pic" title="撤销" />
                        </h:commandLink>
                        <a4j:commandLink  execute="@this" render="appBill" action="#{appPay.getFirst}">
                            <h:graphicImage value="./images/btn_page_first.gif" styleClass="pic" title="首张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="appBill" action="#{appPay.previous}">
                            <h:graphicImage value="./images/btn_page_up.gif" styleClass="pic" title="上张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="appBill" action="#{appPay.next}">
                            <h:graphicImage value="./images/btn_page_down.gif" styleClass="pic" title="下张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="appBill" action="#{appPay.getLast}">
                            <h:graphicImage value="./images/btn_page_end.gif" styleClass="pic" title="末张" />
                        </a4j:commandLink>
                        <h:commandLink  action="#{appPay.goback}">
                            <h:graphicImage value="./images/goback.png" styleClass="pic" title="返回" />
                        </h:commandLink>
                    </rich:toolbarGroup>
                </rich:toolbar>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">付款申请单</legend>

                    <h:panelGroup  id="edit">
                        <h:panelGrid columns="6" width="100%" border="0" id="appBillinput" styleClass="voucherGrid" style="text-align:left">
                            <h:outputLabel value="单据编号:" />
                            <h:outputText  id="number"  value="#{appPay.voucher.number}"  />

                            <h:outputLabel value="单据日期:" />
                            <h:outputText  id="numDate"  value="#{appPay.voucher.numDate}">
                                <f:convertDateTime pattern="yyyy年mm月dd日" timeZone="GMT+8"/>
                            </h:outputText>
                            <h:outputLabel value="费用承担部门:" />
                            <h:outputText  id="payDept"  value="#{appPay.voucher.payDept.name}"  />

                            <h:outputLabel value="申请人：" />
                            <h:outputText  id="feePerson"   value="#{appPay.voucher.feePer.cpsn_name}"/>

                            <h:outputLabel value="收款单位:"  />
                            <h:outputText  id="receriver" value="#{appPay.partner.simplename}" />

                            <h:outputLabel value="开户行:"  />
                            <h:outputText  id="bank"  value="#{appPay.partner.bank}" />

                            <h:outputLabel value="账号:"  />
                            <h:outputText  id="account"  value="#{appPay.partner.bankAccount}" />

                            <h:outputLabel value="用途:"  />
                            <h:outputText  id="affair"  value="#{appPay.voucher.affair}" />

                            <h:outputLabel value="金额:"  />
                            <h:outputText  id="total"   value="#{appPay.voucher.total}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>

                            <h:outputLabel value="预算项目:"  />
                            <h:outputText  id="projName"   value="#{appPay.voucher.project.finName}"/>

                            <h:outputLabel value="部门:" />
                            <h:outputText  id="department"  value="#{appPay.voucher.dept.name}"  />

                            <h:outputLabel value="制单人：" />
                            <h:outputText  id="person"   value="#{appPay.voucher.user.cpsn_name}"/>

                            <h:outputLabel value="附件张数：" />
                            <h:outputText  id="affixAmount" value="#{appPay.voucher.affixAmount}"  />

                            <h:outputText value="支付方式:"/>
                            <h:outputText  id="name" value="#{appPay.voucher.payStyle.name}"  />

                            <h:outputLabel value="备注:"  />
                            <h:outputText  id="memo" value="#{appPay.voucher.memo}"  />

                        </h:panelGrid>
                    </h:panelGroup>
                </fieldset>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">付款申请单审核</legend>

                    <h:panelGrid columns="6" width="100%" border="0" id="mainform1" styleClass="checkGrid" style="text-align:left">
                        <h:outputLabel value="核定金额:"  />
                        <h:outputText  id="totalnew"  value="#{appPay.voucher.checkaccount}" >
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>

                        <h:outputLabel value="经济分类:"  />
                        <h:outputText  id="costname" value="#{appPay.voucher.costitem.name}"/>

                        <h:outputText value="预算来源："  />
                        <h:outputText  id="budgetSource" value="#{appPay.voucher.budgetSource}"/>

                        <h:outputText value="支出类别:" />
                        <h:outputText value="基本支出" rendered="#{appPay.voucher.costClass == '0'}"/>
                        <h:outputText value="项目支出" rendered="#{appPay.voucher.costClass == '1'}"/>

                        <h:outputText value="支出渠道:" />
                        <h:outputText  id="costTypeName" value="#{appPay.voucher.costTypes.name}"/>

                        <h:outputText value="支付令:"/>
                        <h:outputText  id="paycode"  value="#{appPay.voucher.paycode}" />

                        <h:outputLabel value="审核人" />
                        <h:outputText  id="auditor"  value="#{appPay.voucher.auditor}"  />

                        <h:outputLabel value="审核日期:"/>
                        <h:outputText  id="auditDate"  value="#{appPay.voucher.auditDate}">
                            <f:convertDateTime pattern="yyyy年mm月dd日" timeZone="GMT+8"/>
                        </h:outputText>
                    </h:panelGrid>
                </fieldset>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">付款申请单支付</legend>

                    <h:panelGrid columns="4" width="100%" border="0" id="payform" style="text-align:left">

                        <h:outputLabel value="支付方式: " />
                        <h:panelGroup >
                            <h:selectOneMenu value="#{appPay.voucher.payStyle.code}"
                                             valueChangeListener="#{appPay.payWayChange}"
                                             style=" width: 198px;"
                                             disabled="#{appPay.voucher.numberStatus != '2'}">
                                <f:selectItem itemValue=" " itemLabel="-请选择-"/>
                                <f:selectItems value="#{appPay.payStyleList}" />
                                <a4j:ajax event="change" render="payform" listener="#{appPay.changeCashPaid}" />
                            </h:selectOneMenu>
                        </h:panelGroup> 

                        <h:outputLabel value="支付凭证号:" />
                        <h:panelGroup>
                            <h:panelGroup rendered="#{appPay.voucher.numberStatus == '2'}">
                                #{appPay.voucher.number}
                                <h:inputText size="21" value="#{appPay.voucher.ticketcode}"/>
                            </h:panelGroup>
                            <h:outputLabel value="#{appPay.voucher.ticketcode}"
                                           style="margin-left: 0px;padding-left: 0px;"
                                           rendered="#{appPay.voucher.numberStatus != '2'}"/>
                        </h:panelGroup>

                        <h:outputLabel value="支付金额:" />
                        <h:inputText  id="payaccount"   size="28" value="#{appPay.voucher.payaccount}"
                                      disabled="#{appPay.voucher.numberStatus != '2'}">
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:inputText>

                        <h:outputLabel value="收款单位:" />
                        <h:inputText  id="reciveName"   size="28" value="#{appPay.voucher.rec.name}"
                                      disabled="#{appPay.voucher.numberStatus != '2'}"/>

                        <h:outputLabel value="账号:" />
                        <h:inputText  id="reciveAccount"   size="28" value="#{appPay.voucher.rec.account}"
                                      disabled="#{appPay.voucher.numberStatus != '2'}"/>

                        <h:outputLabel value="开户行:" />
                        <h:inputText  id="reciveBank"   size="28" value="#{appPay.voucher.rec.bank}"
                                      disabled="#{appPay.voucher.numberStatus != '2'}"/>

                        <h:outputLabel value="出纳:" />
                        <h:inputText  id="payer"   size="28" value="#{appPay.voucher.payer}" disabled="true" />

                        <h:outputLabel value="支付日期:" />
                        <h:panelGroup>
                            <rich:calendar value="#{appPay.voucher.payDate}"
                                           locale="zh_CN" disabled="true"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false" inputClass="inputstype" />
                        </h:panelGroup>
                        <h:outputLabel value="现金付讫:" style="color:red"/>
                        <h:selectOneRadio id="cashPaid"  value="#{appPay.voucher.cashPaid}"
                                          disabled="#{appPay.voucher.numberStatus != '2'}">
                            <f:selectItem itemLabel="是" itemValue="1"/>
                            <f:selectItem itemLabel="否" itemValue="0"/>
                        </h:selectOneRadio>

                        <h:outputLabel value="支付完毕:" style="color:red"/>
                        <h:selectOneRadio id="numberStatus"  value="#{appPay.voucher.numberStatus}"
                                          disabled="#{appPay.voucher.numberStatus != '2'}">
                            <f:selectItem itemLabel="是" itemValue="6"/>
                            <f:selectItem itemLabel="否" itemValue="4"/>
                        </h:selectOneRadio>
                    </h:panelGrid>
                </fieldset>
            </rich:panel>
        </h:form>
    </h:body>
</html>
